
import 'dart:ffi';

import 'package:json_annotation/json_annotation.dart';

part 'task_detail_model.g.dart';

@JsonSerializable()
class TaskDetailModel {
  final int approveCount;
  final List<String>? approveUserAvatars;
  final String bidSubmitDurationTimeDisplay;
  final int bidTimesByUser;
  @JsonKey(name: 'blackUser', defaultValue: false)
  final bool blackUser;
  @JsonKey(name: 'deviceType', defaultValue: '')
  final String deviceType;
  final String endTimeDisplay;
  final int leftBidTime;
  final String openView;
  final String orderNo;
  final String publisherName;
  final String publisherPlatformId;
  final String publisherVartar;
  final String? pushUserid;
  final int readSeconds;
  final String rewardAmountDisplay;
  final String statusLabel;
  final String taskCategory;
  final String taskDescription;
  final List<String> taskLinks;
  final String taskNo;
  final String taskRequirement;
  final List<String> taskRequirementImages;
  final String taskStatus;
  final List<String> taskStepImages;
  final List<TaskStep> taskStepList;
  final String taskSteps;
  final String taskTitle;
  final String taskType;

  TaskDetailModel({
    required this.approveCount,
    required this.approveUserAvatars,
    required this.bidSubmitDurationTimeDisplay,
    required this.bidTimesByUser,
    required this.blackUser,
    required this.deviceType,
    required this.endTimeDisplay,
    required this.leftBidTime,
    required this.openView,
    required this.orderNo,
    required this.publisherName,
    required this.publisherPlatformId,
    required this.publisherVartar,
    required this.pushUserid,
    required this.readSeconds,
    required this.rewardAmountDisplay,
    required this.statusLabel,
    required this.taskCategory,
    required this.taskDescription,
    required this.taskLinks,
    required this.taskNo,
    required this.taskRequirement,
    required this.taskRequirementImages,
    required this.taskStatus,
    required this.taskStepImages,
    required this.taskStepList,
    required this.taskSteps,
    required this.taskTitle,
    required this.taskType,
  });

  factory TaskDetailModel.fromJson(Map<String, dynamic> json) =>
      _$TaskDetailModelFromJson(json);

  Map<String, dynamic> toJson() => _$TaskDetailModelToJson(this);
}

@JsonSerializable()
class TaskStep {
  final int id;
  final int sortValue;
  final String taskCopyInfo;
  final String taskDescription;
  final List<String> taskLinks;
  final List<String> taskStepImages;
  final String taskStepType;

  TaskStep({
    required this.id,
    required this.sortValue,
    required this.taskCopyInfo,
    required this.taskDescription,
    required this.taskLinks,
    required this.taskStepImages,
    required this.taskStepType,
  });

  factory TaskStep.fromJson(Map<String, dynamic> json) =>
      _$TaskStepFromJson(json);

  Map<String, dynamic> toJson() => _$TaskStepToJson(this);
}